Drop gtk_application_is_inhibited
authorMatthias Clasen <mclasen@redhat.com>
Wed, 29 Nov 2017 04:02:58 +0000 (23:02 -0500)
committerMatthias Clasen <mclasen@redhat.com>
Wed, 29 Nov 2017 04:02:58 +0000 (23:02 -0500)
This function returns global session state that may
not be available to applications (e.g. in sandboxed
environments), and is not needed by applications,
so just drop it, instead of keeping a function around
that can't be guaranteed to work.

gtk/gtkapplication-dbus.c
gtk/gtkapplication-quartz.c
gtk/gtkapplication.c
gtk/gtkapplication.h
gtk/gtkapplicationimpl.c

index febb76df36ba5a097dc17065ea83adfcd7bd2cea..d5d929b22f08eb1b8fe2ea63ea5c52215018d495 100644 (file)
@@ -611,45 +611,6 @@ gtk_application_impl_dbus_uninhibit (GtkApplicationImpl *impl,
     }
 }
 
-static gboolean
-gtk_application_impl_dbus_is_inhibited (GtkApplicationImpl         *impl,
-                                        GtkApplicationInhibitFlags  flags)
-{
-  GtkApplicationImplDBus *dbus = (GtkApplicationImplDBus *) impl;
-  GVariant *res;
-  GError *error = NULL;
-  gboolean inhibited;
-  static gboolean warned = FALSE;
-
-  if (dbus->sm_proxy == NULL)
-    return FALSE;
-
-  res = g_dbus_proxy_call_sync (dbus->sm_proxy,
-                                "IsInhibited",
-                                g_variant_new ("(u)", flags),
-                                G_DBUS_CALL_FLAGS_NONE,
-                                G_MAXINT,
-                                NULL,
-                                &error);
-  if (error)
-    {
-      if (!warned)
-        {
-          g_warning ("Calling %s.IsInhibited failed: %s",
-                     g_dbus_proxy_get_interface_name (dbus->sm_proxy),
-                     error->message);
-          warned = TRUE;
-        }
-      g_error_free (error);
-      return FALSE;
-    }
-
-  g_variant_get (res, "(b)", &inhibited);
-  g_variant_unref (res);
-
-  return inhibited;
-}
-
 static gboolean
 gtk_application_impl_dbus_prefers_app_menu (GtkApplicationImpl *impl)
 {
@@ -718,7 +679,6 @@ gtk_application_impl_dbus_class_init (GtkApplicationImplDBusClass *class)
   impl_class->set_menubar = gtk_application_impl_dbus_set_menubar;
   impl_class->inhibit = gtk_application_impl_dbus_inhibit;
   impl_class->uninhibit = gtk_application_impl_dbus_uninhibit;
-  impl_class->is_inhibited = gtk_application_impl_dbus_is_inhibited;
   impl_class->prefers_app_menu = gtk_application_impl_dbus_prefers_app_menu;
 
   gobject_class->finalize = gtk_application_impl_dbus_finalize;
index 9794d7b8624045f11a8d889bc6d4292305c026bc..55f51e6a89a9becd2b0c60dc2ee7f11e3be5dd27 100644 (file)
@@ -292,18 +292,6 @@ gtk_application_impl_quartz_uninhibit (GtkApplicationImpl *impl,
   g_warning ("Invalid inhibitor cookie");
 }
 
-static gboolean
-gtk_application_impl_quartz_is_inhibited (GtkApplicationImpl         *impl,
-                                          GtkApplicationInhibitFlags  flags)
-{
-  GtkApplicationImplQuartz *quartz = (GtkApplicationImplQuartz *) impl;
-
-  if (flags & GTK_APPLICATION_INHIBIT_LOGOUT)
-    return quartz->quit_inhibit > 0;
-
-  return FALSE;
-}
-
 static void
 gtk_application_impl_quartz_init (GtkApplicationImplQuartz *quartz)
 {
@@ -332,7 +320,6 @@ gtk_application_impl_quartz_class_init (GtkApplicationImplClass *class)
   class->set_menubar = gtk_application_impl_quartz_set_menubar;
   class->inhibit = gtk_application_impl_quartz_inhibit;
   class->uninhibit = gtk_application_impl_quartz_uninhibit;
-  class->is_inhibited = gtk_application_impl_quartz_is_inhibited;
 
   gobject_class->finalize = gtk_application_impl_quartz_finalize;
 }
index 39a49638c974405724399f6f5381377f4103c5ba..b96980fbb39201040e7e906400d03d669395807c 100644 (file)
@@ -1150,31 +1150,6 @@ gtk_application_uninhibit (GtkApplication *application,
   gtk_application_impl_uninhibit (application->priv->impl, cookie);
 }
 
-/**
- * gtk_application_is_inhibited:
- * @application: the #GtkApplication
- * @flags: what types of actions should be queried
- *
- * Determines if any of the actions specified in @flags are
- * currently inhibited (possibly by another application).
- *
- * Note that this information may not be available (for example
- * when the application is running in a sandbox).
- *
- * Returns: %TRUE if any of the actions specified in @flags are inhibited
- *
- * Since: 3.4
- */
-gboolean
-gtk_application_is_inhibited (GtkApplication             *application,
-                              GtkApplicationInhibitFlags  flags)
-{
-  g_return_val_if_fail (GTK_IS_APPLICATION (application), FALSE);
-  g_return_val_if_fail (!g_application_get_is_remote (G_APPLICATION (application)), FALSE);
-
-  return gtk_application_impl_is_inhibited (application->priv->impl, flags);
-}
-
 GtkActionMuxer *
 gtk_application_get_parent_muxer_for_window (GtkWindow *window)
 {
index 3b7cb1a3ee5da819c3785bcb7e9641b946656d3d..badb3f03385aed6899e00ed4221232bfdb5fd36b 100644 (file)
@@ -117,9 +117,6 @@ guint            gtk_application_inhibit            (GtkApplication
 GDK_AVAILABLE_IN_3_4
 void             gtk_application_uninhibit          (GtkApplication             *application,
                                                      guint                       cookie);
-GDK_AVAILABLE_IN_3_4
-gboolean         gtk_application_is_inhibited       (GtkApplication             *application,
-                                                     GtkApplicationInhibitFlags  flags);
 
 GDK_AVAILABLE_IN_3_6
 GtkWindow *      gtk_application_get_window_by_id   (GtkApplication             *application,
index 946284b19a44a62f9d2c626bb2456bccedadeea9..c72514d0afe40974cb9e05646e7bd94c9374d09b 100644 (file)
@@ -59,7 +59,6 @@ gtk_application_impl_class_init (GtkApplicationImplClass *class)
   class->set_menubar = (gpointer) do_nothing;
   class->inhibit = (gpointer) do_nothing;
   class->uninhibit = (gpointer) do_nothing;
-  class->is_inhibited = (gpointer) do_nothing;
   class->prefers_app_menu = (gpointer) return_false;
 }
 
@@ -148,13 +147,6 @@ gtk_application_impl_uninhibit (GtkApplicationImpl *impl,
   GTK_APPLICATION_IMPL_GET_CLASS (impl)->uninhibit (impl, cookie);
 }
 
-gboolean
-gtk_application_impl_is_inhibited (GtkApplicationImpl         *impl,
-                                   GtkApplicationInhibitFlags  flags)
-{
-  return GTK_APPLICATION_IMPL_GET_CLASS (impl)->is_inhibited (impl, flags);
-}
-
 gboolean
 gtk_application_impl_prefers_app_menu (GtkApplicationImpl *impl)
 {